<link rel="stylesheet" href="__CDN__/assets/element-ui-2.15.14/css/index.css">
<link rel="stylesheet" href="__CDN__/assets/css/vvv.css">
<style>
    .el-form-item__label {
        width: 120px !important;
    }

    .el-tag + .el-tag {
        margin-left: 10px;
    }

    .button-new-tag {
        margin-left: 10px;
        height: 32px;
        line-height: 30px;
        padding-top: 0;
        padding-bottom: 0;
    }

    .input-new-tag {
        width: 90px;
        margin-left: 10px;
        vertical-align: bottom;
    }

    input[type="file"] {
        display: none !important;
    }

    .el-form-item__error {
        margin-left: 30px;
    }

    .search-select .el-select .el-input__inner {
        width: 130px;
    }

    .key .el-input__inner {
        /*width: 240px !important;*/
    }

    .vue-table {
        padding: 0;
    }

    #box {
        display: flex;
    }

    #box .left {
        width: 270px;
        border-right: 1px solid #ebeef5;
        margin-right: 20px;
    }

    #box .left .li {
        height: 30px;
        line-height: 30px;
        margin-bottom: 20px;
        text-align: center;
        cursor: pointer;
        font-size: 14px;
    }

    #box .left .category-selected {
        background: #7438d5;
        color: #fff;
    }

    #box .right {
        width: 100%;
    }

    .content {
        padding: 0 !important;
    }

    .el-tree-node__label {
        font-size: 16px !important;
    }

    .el-tree-node {
        margin-bottom: 4px;
    }

    .search {
        margin: 10px;
    }
</style>
<div id="vue" v-cloak>
    <div id="box">
        <div class="left">
            <div class="search">
                <el-input placeholder="输入名称搜索" v-model="navName" size="small" class="input-with-select">
                    <el-button @click="handleSearchNav" slot="append" icon="el-icon-search"></el-button>
                </el-input>
            </div>
            <div class="ul">
                <el-tree :data="navList" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
            </div>
        </div>
        <div class="right">
            <div class="screen-container">
                <div class="screen-container-show">
                    <div class="screen-container-left display-flex">
                        <el-button size="small" @click="refreshPage" icon="el-icon-refresh" circle type="primary"></el-button>
                        <div class="datetime">
                            <el-date-picker
                                    v-model="search.startTime"
                                    type="datetime"
                                    placeholder="选择起始时间">
                            </el-date-picker>
                        </div>
                        <div class="datetime">
                            <el-date-picker
                                    v-model="search.endTime"
                                    type="datetime"
                                    placeholder="选择结束时间">
                            </el-date-picker>
                        </div>
                    </div>
                    <div class="search-select screen-container-right display-flex keyword">
                        <el-select v-model="search.typeIndex" @clear="handleClearSelect('typeIndex')" clearable placeholder="文件类型">
                            <el-option
                                    v-for="item in typeList"
                                    :key="item.index"
                                    :label="item.name"
                                    :value="item.index">
                            </el-option>
                        </el-select>
                    </div>
                    <div class="search-select screen-container-right display-flex keyword key">
                        <el-input @keyup.enter.native="searchData" @clear="handleClearSearchInp" clearable v-model="search.keyword" placeholder="请输入您要搜索的内容">
                            <el-select v-model="search.type" filterable clearable slot="prepend" placeholder="请选择">
                                <el-option v-for="(item, index) in searchOpt" :label="item.value"
                                           :value="item.id">
                                </el-option>
                            </el-select>
                            <el-button slot="append" @click="searchData" icon="el-icon-search"></el-button>
                        </el-input>
                    </div>
                    <div class="screen-container-right display-flex keyword">
                        <el-upload
                                :data="{nid: search.nid}"
                                style="margin-right: 10px;"
                                class="upload-img"
                                :multiple="true"
                                :show-file-list="false"
                                :before-upload="beforeFileUpload"
                                :on-success="uploadFileSuccess"
                                accept=".jpg,.jpeg,.gif,.png"
                                action="{:url('ajax/upload')}"
                        >
                            <el-button size="small" type="primary" plain icon="el-icon-upload">上传
                            </el-button>
                        </el-upload>
                        {if ($multiple == 'true')}
                        <el-button size="small" @click="handleSelectFile('', 'multiple')" type="success" plain icon="el-icon-check">选择
                        </el-button>
                        {/if}
                        <el-button size="small" @click="handleOpenNav" type="primary" plain icon="el-icon-menu">分类管理
                        </el-button>
                    </div>
                </div>
            </div>
            <div class="vue-table background-white color-666">
                <el-table :data="tableData" border highlight-current-row v-loading="listLoading"
                          @sort-change="handleTableFieldSort" element-loading-text="拼命加载中..."
                          @selection-change="handleSelectionChange" style="width: 100%">
                    {if ($multiple == 'true')}
                    <el-table-column type="selection" width="60" align="center"></el-table-column>
                    {/if}
<!--                    <el-table-column prop="id" width="80" label="ID" show-overflow-tooltip-->
<!--                                     align="center"></el-table-column>-->
                    <el-table-column prop="category" width="200" label="类别" show-overflow-tooltip
                                     align="center">
                        <template scope="scope">
                            <span>{{scope.row.nav_name}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="image" label="图片" width="100" align="center">
                        <template scope="scope">
                            <a v-if="scope.row.mimetype.indexOf('image') >= 0" style="cursor: pointer;" :href="scope.row.url" target="_blank">
                                <img :src="scope.row.url" style="border-radius: 10px;width: 50px;height: 50px;padding: 5px">
                            </a>
                            <a v-else style="cursor: pointer;" :href="scope.row.url" target="_blank">
                                <img src="/assets/img/video-video.png" style="border-radius: 10px;width: 50px;height: 50px;padding: 5px">
                            </a>
                        </template>
                    </el-table-column>
                    <el-table-column prop="filename" sortable="custom" label="文件名" show-overflow-tooltip
                                     align="center"></el-table-column>
                    <el-table-column prop="imagewidth" width="80" label="宽" show-overflow-tooltip
                                     align="center"></el-table-column>
                    <el-table-column prop="imageheight" width="80" label="高" show-overflow-tooltip
                                     align="center"></el-table-column>
                    <el-table-column prop="mimetype" width="110" label="文件类型" show-overflow-tooltip
                                     align="center"></el-table-column>
                    <el-table-column prop="createtime" sortable="custom" width="160" :formatter="dateFormat" label="创建日期" show-overflow-tooltip
                                     align="center"></el-table-column>
                    <el-table-column align="center" width="130" fixed="right" label="操作">
                        <template scope="scope">
                            <button
                                    @click="handleSelectFile(scope.row, 'one')"
                                    type="button"
                                    class="el-button el-button--success el-button--small"
                            >
                                <i class="el-icon-check"></i><span>选择</span></button>
                        </template>
                    </el-table-column>
                </el-table>
                <div class="layout-pagination">
                    <el-pagination
                            background
                            @size-change="handleSizeChange"
                            @current-change="handleCurrentChange"
                            :current-page="currentPage"
                            :page-sizes="[10, 20, 50, 100]"
                            :page-size="pageSize"
                            layout="total, sizes, prev, pager, next, jumper"
                            :total="totalCount">
                    </el-pagination>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="__CDN__/assets/element-ui-2.15.14/js/vue.js"></script>
<script src="__CDN__/assets/element-ui-2.15.14/js/index.js"></script>
<script src="__CDN__/assets/tool/libs/moment.js"></script>
<script src="__CDN__/assets/js/jquery-2.1.1.min.js"></script>